import { Callout } from '@theguild/components'

# Consume in other gateways

If you don't use Hive Gateway, but still want to use Mesh Compose to convert non-federated sources
to a federated subgraph. You can still do it but it has some limitations, you need to generate the
subgraph, and serve the subgraph with
[Hive Gateway](https://the-guild.dev/graphql/hive/docs/gateway) But if you use Hive Gateway, you
don't need to worry about this, then you can use the supergraph directly without having multiple
servers.

That's because other gateways are not aware of Mesh Compose's additional directives to handle the
non-federated sources.

This means you can use non-federated sources in any
[Federation](https://the-guild.dev/graphql/hive/federation) compliant gateway such as Apollo
Gateway, Apollo Router or Cosmo Router.

## Generate the subgraph

First, you need to generate the subgraph with Mesh Compose, and then serve the subgraph with Hive
Gateway.

```ts filename="mesh.config.ts"
import { defineConfig } from '@graphql-mesh/compose-cli'
import { loadOpenAPISubgraph } from '@omnigraph/openapi'

export const composeConfig = defineConfig({
  subgraphs: [
    {
      sourceHandler: loadOpenAPISubgraph('Wiki', {
        source: 'https://api.apis.guru/v2/specs/wikimedia.org/1.0.0/swagger.yaml'
      }),
      transforms: [
        /**.. **/
      ]
    }
  ]
})
```

Then you can run the following command to generate the subgraph:

```sh
npx mesh-compose --subgraph Wiki -o wiki-subgraph.graphql
```

You can also use this schema with any schema registry such as
[Hive](https://the-guild.dev/graphql/hive/docs/gateway/supergraph-proxy-source) or
[GraphOS](https://the-guild.dev/graphql/hive/docs/gateway/supergraph-proxy-source).

<Callout>
For example, with GraphQL Hive CLI you can publish this subgraph with the following command:

```sh
hive schema:publish \
  --registry.accessToken YOUR_TOKEN_HERE \
  --service="reviews" \
  --url="http://fake.com/reviews/graphql" \
  --author "Me" \
  --commit "Second" \
  wiki-subgraph.graphql
```

</Callout>

## Serve the subgraph

Then you can serve the subgraph with Hive Gateway with the following command;

```sh
npx hive-gateway subgraph wiki-subgraph.graphql
```

Then you can use the supergraph in any Federation compliant gateway such as Apollo Gateway, Apollo
Router or Cosmo Router.
